package com.nbjtjc.safe.api.emg;

import com.nbjtjc.safe.annotation.SysLog;
import com.nbjtjc.safe.bean.Page;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.emg.EmgPlanPublicGoods;
import com.nbjtjc.safe.model.emg.EmgPlanPublicResponse;
import com.nbjtjc.safe.service.emg.EmgPlanPublicResponseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther guqianbin
 * @date 2018/7/9 21:38
 * 应急预案的响应
 **/
@RestController
@CrossOrigin("*")
@RequestMapping("/planPublicResponse")
public class EmgPlanPublicResponseController {
    @Autowired
    private EmgPlanPublicResponseService emgPlanPublicResponseService;


    @RequestMapping(value = "/find", method = {RequestMethod.POST,RequestMethod.GET})
    public Result find(EmgPlanPublicResponse emgPlanPublicResponse) {
        Result result = new Result();
        try {
            result.setData(emgPlanPublicResponseService.find(emgPlanPublicResponse));
        } catch (Exception e) {
            e.printStackTrace();
            result.setFalse(e.getMessage());
        }
        return result;
    }


    @RequestMapping(value = "/add", method = {RequestMethod.POST})
    @SysLog("添加应急响应")
    public Result add(EmgPlanPublicResponse emgPlanPublicResponse) {
        Result result = new Result();
        try {
            result.setData(emgPlanPublicResponseService.add(emgPlanPublicResponse));
        } catch (Exception e) {
            e.printStackTrace();
            result.setFalse(e.getMessage());
        }
        return result;
    }

    @RequestMapping(value = "/update", method = {RequestMethod.POST,RequestMethod.GET})
    @SysLog("更新应急响应")
    public Result update(EmgPlanPublicResponse emgPlanPublicResponse) {
        Result result = new Result();
        try {
            result.setData(emgPlanPublicResponseService.update(emgPlanPublicResponse));
        } catch (Exception e) {
            e.printStackTrace();
            result.setFalse(e.getMessage());
        }
        return result;
    }

}
